package com.oracle.controller;

import com.oracle.service.ItemService;
import com.oracle.vo.Item;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/item")
public class ItemController {

    @Autowired
    private ItemService itemService;


    @RequestMapping("/get")
    public Item getItem(@RequestParam(value = "itemNo",defaultValue = "1001") Integer itemNo){

        return itemService.getItem(itemNo);
    }

    @RequestMapping("/saveItem")
    public  String saveItem(@RequestBody Item item){
        itemService.saveItem(item);
        return "<h1>创建成功<h1/>";
    }
}
